package com.sdu.shanyiapi.controller.form;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;

/**
 * @author lihaopeng
 * @version 1.0
 * @project shanyi-api
 * @description 新增用户信息
 * @since 2024/4/21 18:21
 */
@Data
public class InsertOrUpdateUserInfoForm {
    private Integer id;

    @NotBlank(message = "name姓名不能为空")
        @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$", message = "name姓名内容不正确")
    private String name;

    @NotBlank(message = "sex性别不能为空")
    @Pattern(regexp = "^男$|^女$", message = "sex性别格式不正确，只能为男或女")
    private String sex;

    @NotBlank(message = "phone手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "phone手机号格式不正确")
    private String phone;

    @NotBlank(message = "email邮箱不能为空")
    @Email
    @Length(max = 200, message = "email邮箱内容不正确，最多200字符")
    private String email;

    @NotNull(message = "birthday生日不能为空")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    @NotBlank(message = "address地址不能为空")
    @Length(max = 200, message = "address地址内容不正确，最多200字符")
    private String address;

    @NotBlank(message = "height身高不能为空")
    @Pattern(regexp = "^[0-3]\\.\\d{2}$", message = "height身高格式不正确，单位为米，必须有1位整数和2位小数，如1.83")
    private String height;

    @NotBlank(message = "weight体重不能为空")
    @Pattern(regexp = "^(?:\\d{1,2}|[1-4]\\d{2}|500)\\.\\d$", message = "weight体重格式不正确，单位为千克，最多3位整数，必须有1位小数，范围为0.0到500.0，如65.5")
    private String weight;

//    @NotEmpty(message = "likes不能为空")
    private String[] likes;

//    @NotEmpty(message = "dislikes不能为空")
    private String[] dislikes;

    @Length(max = 250, message = "goal目标内容不正确，最多250字符")
    private String goal;

//    @Length(max = 250, message = "diseases疾病内容不正确，最多250字符")
//    private String diseases;
    private String[] diseases;
}
